package com.hei.service.Impl;

import com.hei.dao.RoleDao;
import com.hei.pojo.Role;
import com.hei.pojo.User;
import com.hei.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {

    @Autowired
    private RoleDao roleDao;

    @Override
    public List<Role> showList() {

        return roleDao.findAll();
    }

    public int addRole(Role role) {

        return roleDao.addRole(role);
    }

    @Override
    public int deleteUser(int id) {
        return roleDao.delUser(id);
    }

    @Override
    public List<User> showUserList() {
        return roleDao.showUserList();
    }

    @Override
    public int addUser(User user) {
        return roleDao.addUser(user);
    }

    @Override
    public String getJobName(int id) {
        return roleDao.getJobName(id);
    }

    @Override
    public int[] getJobs(int id) {
        return roleDao.getJobs(id);
    }

    @Override
    public User getUser(int id) {
        return roleDao.getUser(id);
    }

    @Override
    public int updateUser(User user) {
        return roleDao.updateUser(user);
    }

    @Override
    public int updateRole(Role role) {
        return roleDao.updateRole(role);
    }

    @Override
    public int deleteRole(int id) {
        return roleDao.delRole(id);
    }

    @Override
    public Role getRole(int id) {
        return roleDao.getRole(id);
    }

    @Override
    public boolean login(String username, String password) {
        return roleDao.login(username, password);
    }
}
